home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / libdwarf / libdwarf2p.1.mm < prev    next >
Encoding:
Text File  |  1994-08-02  |  42.0 KB  |  1,056 lines

  1. \." $Revision: 1.5 $
  2. \." $Date: 1994/05/18 16:56:22 $
  3. \."
  4. \."
  5. \." the following line may be removed if the ff ligature works on your machine
  6. .lg 0
  7. \." set up heading formats
  8. .ds HF 3 3 3 3 3 2 2
  9. .ds HP +2 +2 +1 +0 +0
  10. .nr Hs 5
  11. .nr Hb 5
  12. .ds | |
  13. .ds ~ ~
  14. .ds ' '
  15. .if t .ds Cw \&\f(CW
  16. .if n .ds Cw \fB
  17. .de Cf          \" Place every other arg in Cw font, beginning with first
  18. .if \\n(.$=1 \&\*(Cw\\$1\fP
  19. .if \\n(.$=2 \&\*(Cw\\$1\fP\\$2
  20. .if \\n(.$=3 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP
  21. .if \\n(.$=4 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4
  22. .if \\n(.$=5 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP
  23. .if \\n(.$=6 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP\\$6
  24. .if \\n(.$=7 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP\\$6\*(Cw\\$7\fP
  25. .if \\n(.$=8 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP\\$6\*(Cw\\$7\fP\\$8
  26. .if \\n(.$=9 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP\\$6\*(Cw\\$7\fP\\$8\
  27. *(Cw
  28. ..
  29. .SA 1
  30. .TL
  31. A Producer Library Interface to DWARF
  32. .AF ""
  33. .AU "UNIX\(rg International Programming Languages Special Interest Group" 
  34. .PF "'$Revision: 1.5 $'- \\\\nP -'$Date: 1994/05/18 16:56:22 $'"
  35. .PM ""
  36. .AS 1
  37. This document describes a proposed interface to a library of functions
  38. .FS \(rg
  39. UNIX is a registered trademark of UNIX System Laboratories, Inc.
  40. in the United States and other countries.
  41. .FE
  42. to create DWARF debugging information entries and DWARF line number
  43. information. It does not make recommendations as to how the functions
  44. described in this document should be implemented nor does it
  45. suggest possible optimizations. 
  46. .P
  47. The document is oriented to creating DWARF version 2.
  48. It will be proposed to the PLSIG DWARF committee as soon
  49. as that makes any sense.
  50. .P
  51. No proposals like this have ever been submitted to the PLSIG
  52. committee....
  53. .P
  54. The proposals made in this document are subject to change.
  55. .P
  56. $Revision: 1.5 $
  57. $Date: 1994/05/18 16:56:22 $
  58. .AE
  59. .MT 4
  60. .H 1 "INTRODUCTION"
  61. This document describes the proposed interface to \fIlibdwarf\fP, a
  62. library of functions to provide creation of DWARF debugging information
  63. records, DWARF line number information, DWARF address range and
  64. pubnames information, weak names informatio, and DWARF frame description 
  65. information.
  66.  
  67. .H 2 "Purpose and Scope"
  68. The purpose of this document is to propose a library of functions to 
  69. create DWARF debugging information.  Reading (consuming) of such records 
  70. is discussed in a separate document.
  71.  
  72. The functions in this document have been implemented at Silicon Graphics
  73. and are being used by the code generator to provide debugging information.
  74.  
  75. .P
  76. Additionally, the focus of this document is the functional interface,
  77. and as such, implementation as well as optimization issues are
  78. intentionally ignored.
  79.  
  80. .P
  81. Error handling, error codes, and certain \fILibdwarf\fP codes are discussed
  82. in the "\fIProposed Interface to DWARF Consumer Library\fP", which should 
  83. be read (or at least skimmed) before reading this document.
  84.  
  85. .H 2 "Definitions"
  86. DWARF debugging information entries (DIE) are the segments of information 
  87. placed in the \f(CW.debug_*\fP sections by compilers, assemblers, and linkage 
  88. editors that, in conjunction with line number entries, are necessary for 
  89. symbolic source-level debugging.  Refer to the document 
  90. "\fIDWARF Debugging Information Format\fP" from UI PLSIG for a more complete 
  91. description of these entries.
  92.  
  93. .P
  94. This document adopts all the terms and definitions in
  95. "\fIDWARF Debugging Information Format\fP" version 2.
  96. and the "\fIProposed Interface to DWARF Consumer Library\fP".
  97.  
  98. .P
  99. In addition, this document refers to ELF, the ATT/USL System V
  100. Release 4 object format.
  101. This is because the library was first developed for that object
  102. format.
  103. Hopefully the functions defined here can easily be
  104. applied to other object formats.
  105.  
  106. .H 2 "Overview"
  107. The remaining sections of this document describe a proposed producer 
  108. (compiler or assembler) interface to \fILibdwarf\fP, first by describing 
  109. the purpose of additional types defined by the interface, followed by 
  110. descriptions of the available operations.  This document assumes you 
  111. are thoroughly familiar with the information contained in the \fIDWARF 
  112. Debugging Information Format\fP document, and 
  113. "\fIProposed Interface to DWARF Consumer Library\fP".
  114.  
  115. .P
  116. The interface necessarily knows a little bit about the object format
  117. (which is assumed to be ELF).  We make an attempt to make this knowledge 
  118. as limited as possible.  For example, \fILibdwarf\fP does not do the 
  119. writing of object data to the disk.  The producer program does that.
  120.  
  121. .H 2 "Revision History"
  122. .VL 15
  123. .LI "March 93"
  124. Work on dwarf2 sgi producer draft begins
  125. .LE
  126.  
  127. .H 1 "Type Definitions"
  128.  
  129. .H 2 "General Description"
  130. The \fIlibdwarf.h\fP header file contains typedefs and preprocessor 
  131. definitions of types and symbolic names used to reference objects of 
  132. \fILibdwarf\fP.  The types defined by typedefs contained in \fIlibdwarf.h\fP 
  133. all use the convention of adding \f(CWDwarf_\fP as a prefix to
  134. indicate that they refer to objects used by Libdwarf.  The prefix
  135. \f(CWDwarf_P_\fP is used for object referenced by the \f(CWLibdwarf\fP 
  136. Producer when there are similar but distinct objects used by the Consumer.
  137.  
  138. .H 2 "Aggregate Types"
  139.  
  140. .H 1 "Memory Management"
  141.  
  142. Several of the functions that comprise the \fILibdwarf\fP interface 
  143. return values that have been dynamically allocated by the library.  
  144. Space is always allocated for an object represented by a 
  145. \f(CWDwarf_P_Debug\fP descriptor.  The \f(CWLibdwarf\fP typically 
  146. deals with one object at a time.  The dynamically allocated spaces 
  147. can not be reclaimed except by \f(CWdwarf_producer_finish()\fP.  
  148. This function reclaims all the space, and invalidates all descriptors 
  149. returned from \f(CWLibdwarf\fP functions that add information to be 
  150. object specified.  After \f(CWdwarf_producer_finish()\fP is called, 
  151. the \f(CWDwarf_P_Debug\fP descriptor specified is also invalid.
  152.  
  153. .H 2 "Read-only Properties"
  154. All pointers returned by or as a result of a \fILibdwarf\fP call should 
  155. be assumed to point to read-only memory.  
  156. Except as defined by this document, the results are undefined for 
  157. \fILibdwarf\fP clients that attempt to write to a region pointed to by a 
  158. return value from a \fILibdwarf\fP call.
  159.  
  160. .H 2 "Storage Deallocation"
  161. Calling \f(CWdwarf_producer_finish(dbg)\fP frees all the space, and 
  162. invalidates all pointers returned from \f(CWLibdwarf\fP functions on 
  163. or descended from \f(CWdbg\fP).
  164.  
  165. .H 1 "Functional Interface"
  166. This section describes the functions available in the \fILibdwarf\fP
  167. library.  Each function description includes its definition, followed 
  168. by a paragraph describing the function's operation.
  169.  
  170. .P
  171. The functions may be categorized into groups: 
  172. \fIinitialization and termination operations\fP,
  173. \fIdebugging information entry creation\fP,
  174. \fIElf section callback function\fP,
  175. \fIattribute creation\fP,
  176. \fIexpression creation\fP, 
  177. \fIline number creation\fP, 
  178. \fIfast-access (aranges) creation\fP, 
  179. \fIfast-access (pubnames) creation\fP, 
  180. \fIfast-access (weak names) creation\fP,
  181. \fImacro information creation\fP, 
  182. \fIlow level (.debug_frame) creation\fP, 
  183. and
  184. \fIlocation list (.debug_loc) creation\fP. 
  185.  
  186. .P
  187. The following sections describe these functions.
  188.  
  189. .H 2 "Initialization and Termination Operations"
  190. These functions setup \f(CWLibdwarf\fP to accumulate debugging information
  191. for an object, usually a compilation-unit, provided by the producer.
  192. The actual addition of information is done by functions in the other
  193. sections of this document.  Once all the information has been added,
  194. functions from this section are used to transform the information to
  195. appropriate byte streams, and help to write out the byte streams to
  196. disk.
  197.  
  198. Typically then, a producer would create a \f(CWDwarf_P_Debug\fP 
  199. descriptor to gather debugging information for a particular
  200. compilation-unit using \f(CWdwarf_producer_init()\fP.  They would 
  201. use this \f(CWDwarf_P_Debug\fP descriptor to accumulate debugging 
  202. information for this object using functions from other sections of 
  203. this document.  Once all the information had been added, they would 
  204. call \f(CWdwarf_transform_to_disk_form()\fP to convert the accumulated 
  205. information into byte streams in accordance with the \f(CWDWARF\fP 
  206. standard.  They would then repeatedly call \f(CWdwarf_get_section_bytes()\fP 
  207. for each of the \f(CW.debug_*\fP created.  This would give the producer 
  208. information about the data bytes to be written to disk.  At this point, 
  209. the producer would release all resource used by \f(CWLibdwarf\fP for 
  210. this object by calling \f(CWdwarf_producer_finish()\fP.
  211.  
  212. .DS
  213. \f(CWDwarf_P_Debug dwarf_producer_init(
  214.         Dwarf_Unsigned flags,
  215.         Dwarf_Callback_Func func,
  216.         Dwarf_Handler errhand,
  217.         Dwarf_Ptr errarg,
  218.         Dwarf_Error *error)\fP
  219. .DE
  220. The function \f(CWdwarf_producer_init()\fP returns a new 
  221. \f(CWDwarf_P_Debug\fP descriptor that can be used to add \f(CWDwarf\fP 
  222. information to the object.  On error it returns \f(CWDW_DLV_BADADDR\fP.  
  223. \f(CWflags\fP determine whether the target object is 64-bit or 32-bit.  
  224. \f(CWfunc\fP is a pointer to a function called-back from \fILibdwarf\fP 
  225. whenever \fILibdwarf\fP needs to create a new object section (as it will 
  226. for each .debug_* section and related relocation section).  \f(CWerrhand\fP 
  227. is a pointer to a function that will be used for handling errors detected 
  228. by \f(CWLibdwarf\fP.  \f(CWerrarg\fP is the default error argument used 
  229. by the function pointed to by \f(CWerrhand\fP.
  230.  
  231. .DS
  232. \f(CWDwarf_Signed dwarf_transform_to_disk_form(
  233.         Dwarf_P_Debug dbg,
  234.         Dwarf_Error* error)\fP
  235. .DE
  236. The function \f(CWdwarf_transform_to_disk_form()\fP does the actual
  237. conversion of the \f(CWDwarf\fP information provided so far, to the
  238. form that is 
  239. normally written out as \f(CWElf\fP sections.  In other words, 
  240. once all DWARF information has been passed to \fILibdwarf\fP, call 
  241. \f(CWdwarf_transform_to_disk_form()\fP to transform all the accumulated 
  242. data into byte streams.  This includes turning relocation information 
  243. into byte streams.  This function does not write anything to disk.  If 
  244. successful, it returns a count of the number of \f(CWElf\fP sections 
  245. ready to be retrieved (and, normally, written to disk).
  246. In case of error, it returns 
  247. \f(CWDW_DLV_NOCOUNT\fP.
  248.  
  249. .DS
  250. \f(CWDwarf_Ptr dwarf_get_section_bytes(
  251.         Dwarf_P_Debug dbg,
  252.         Dwarf_Signed dwarf_section,
  253.         Dwarf_Signed *elf_section_index, 
  254.         Dwarf_Unsigned *length,
  255.         Dwarf_Error* error)\fP
  256. .DE
  257. The function \f(CWdwarf_get_section_bytes()\fP must be called repetitively, 
  258. with the index \f(CWdwarf_section\fP starting at 0 and continuing for the 
  259. number of sections returned by \f(CWdwarf_transform_to_disk_form()\fP.
  260. It returns \f(CWNULL\fP to indicate that there are no more sections of 
  261. \f(CWDwarf\fP information.  For each non-NULL return, the returned-pointer
  262. points to \f(CW*length\fP bytes of data that are normally
  263. added to the output 
  264. object in \f(CWElf\fP section \f(CW*elf_section\fP by the producer application.
  265.  
  266. .DS
  267. \f(CWDwarf_Signed dwarf_producer_finish(
  268.         Dwarf_P_Debug dbg,
  269.         Dwarf_Error* error)\fP
  270. .DE
  271. The function \f(CWdwarf_producer_finish()\fP should be called after all 
  272. the bytes of data have been wn copied somewhere
  273. (normally the bytes are written to disk).  It frees all dynamic space 
  274. allocated for \f(CWdbg\fP, include space for the structure pointed to by
  275. \f(CWdbg\fP.  This should not be called till the data have been 
  276. copied or written 
  277. to disk or are no longer of interest.  
  278. It returns non-zero if successful, and \f(CWDW_DLV_NOCOUNT\fP 
  279. if there is an error.
  280.  
  281. .H 2 "Debugging Information Entry Creation"
  282. The functions in this section add new \f(CWDIE\fPs to the object,
  283. and also the relatioships among the \f(CWDIE\fP to be specified
  284. by linking them up as parents, children, left or right siblings
  285. of each other.  In addition, there is a function that marks the
  286. root of the graph thus created.
  287.  
  288. .DS
  289. \f(CWDwarf_Unsigned dwarf_add_die_to_debug(
  290.         Dwarf_P_Debug dbg,
  291.         Dwarf_P_Die first_die,
  292.         Dwarf_Error *error)\fP
  293. .DE
  294. The function \f(CWdwarf_add_die_to_debug()\fP indicates to \f(CWLibdwarf\fP
  295. the root \f(CWDIE\fP of the \f(CWDIE\fP graph that has been built so 
  296. far.  It is intended to mark the compilation-unit \f(CWDIE\fP for the 
  297. object represented by \f(CWdbg\fP.  The root \f(CWDIE\fP is specified 
  298. by \f(CWfirst_die\fP.
  299.  
  300. It returns \f(CW0\fP on success, and \f(CWDW_DLV_NOCOUNT\fP on error.
  301.  
  302. .DS
  303. \f(CWDwarf_P_Die dwarf_new_die(
  304.         Dwarf_P_Debug dbg, 
  305.         Dwarf_Tag new_tag,
  306.         Dwarf_P_Die parent,
  307.         Dwarf_P_Die child,
  308.         Dwarf_P_Die left_sibling, 
  309.         Dwarf_P_Die right_sibling,
  310.         Dwarf_Error *error)\fP
  311. .DE
  312. The function \f(CWdwarf_new_die()\fP creates a new \f(CWDIE\fP with
  313. its parent, child, left sibling, and right sibling \f(CWDIE\fPs
  314. specified by \f(CWparent\fP, \f(CWchild\fP, \f(CWleft_sibling\fP,
  315. and \f(CWright_sibling\fP, respectively.  There is no requirement
  316. that all of these \f(CWDIE\fPs be specified, i.e. any of these
  317. descriptors may be \f(CWNULL\fP.  If none is specified, this will
  318. be an isolated \f(CWDIE\fP.  
  319. A \f(CWDIE\fP is 
  320. transformed to disk form by \f(CWdwarf_transform_to_disk_form()\fP 
  321. only if there is a path from
  322. the \f(CWDIE\fP specified by \f(CWdwarf_add_die_to_debug\fP to it.
  323. This function returns \f(CWDW_DLV_BADADDR\fP on error.
  324.  
  325. \f(CWnew_tag\fP is the tag which is given to the new \f(CWDIE\fP.
  326. \f(CWparent\fP, \f(CWchild\fP, \f(CWleft_sibling\fP, and
  327. \f(CWright_sibling\fP are pointers to establish links to existing 
  328. \f(CWDIE\fPs.  Only one of \f(CWparent\fP, \f(CWchild\fP, 
  329. \f(CWleft_sibling\fP, and \f(CWright_sibling\fP may be non-NULL.
  330. If \f(CWparent\fP (\f(CWchild\fP) is given, the \f(CWDIE\fP is 
  331. linked into the list after (before) the \f(CWDIE\fP pointed to.  
  332. If \f(CWleft_sibling\fP (\f(CWright_sibling\fP) is given, the 
  333. \f(CWDIE\fP is linked into the list after (before) the \f(CWDIE\fP 
  334. pointed to.
  335.  
  336. To add attributes to the new \f(CWDIE\fP, use the \f(CWAttribute Creation\fP 
  337. functions defined in the next section.
  338.  
  339. .DS
  340. \f(CWDwarf_P_Die dwarf_die_link(
  341.         Dwarf_P_Die die, 
  342.         Dwarf_P_Die parent,
  343.         Dwarf_P_Die child,
  344.         Dwarf_P_Die left-sibling, 
  345.         Dwarf_P_Die right_sibling,
  346.         Dwarf_Error *error)\fP
  347. .DE
  348. The function \f(CWdwarf_die_link()\fP links an existing \f(CWDIE\fP
  349. described by the given \f(CWdie\fP to other existing \f(CWDIE\fPs.
  350. The given \f(CWdie\fP can be linked to a parent \f(CWDIE\fP, a child
  351. \f(CWDIE\fP, a left sibling \f(CWDIE\fP, or a right sibling \f(CWDIE\fP
  352. by specifying non-NULL \f(CWparent\fP, \f(CWchild\fP, \f(CWleft_sibling\fP,
  353. and \f(CWright_sibling\fP \f(CWDwarf_P_Die\fP descriptors.  It returns
  354. the given \f(CWDwarf_P_Die\fP descriptor, \f(CWdie\fP, on success,
  355. and \f(CWDW_DLV_BADADDR\fP on error.
  356.  
  357. Only one of \f(CWparent\fP, \f(CWchild\fP, \f(CWleft_sibling\fP,
  358. and \f(CWright_sibling\fP may be non-NULL.  If \f(CWparent\fP
  359. (\f(CWchild\fP) is given, the \f(CWDIE\fP is linked into the list 
  360. after (before) the \f(CWDIE\fP pointed to.  If \f(CWleft_sibling\fP
  361. (\f(CWright_sibling\fP) is given, the \f(CWDIE\fP is linked into 
  362. the list after (before) the \f(CWDIE\fP pointed to.  Non-NULL links
  363. overwrite the corresponding links the given \f(CWdie\fP may have
  364. had before the call to \f(CWdwarf_die_link()\fP.
  365.  
  366. .H 2 "Attribute Creation"
  367. The functions in this section add attributes to a \f(CWDIE\fP.
  368. These functions return a \f(CWDwarf_P_Attribute\fP descriptor 
  369. that represents the attribute added to the given \f(CWDIE\fP.  
  370. In most cases the return value is only useful to determine if 
  371. an error occurred.
  372.  
  373. Some of the attributes have values that are relocatable.  They
  374. need a symbol with respect to which the linker will perform
  375. relocation.  This symbol is specified by means of an index into
  376. the Elf symbol table for the object.
  377.  
  378. .DS
  379. \f(CWDwarf_P_Attribute dwarf_add_AT_location_expr(
  380.         Dwarf_P_Debug dbg,
  381.         Dwarf_P_Die ownerdie,
  382.         Dwarf_Half attr,
  383.         Dwarf_P_Expr loc_expr,
  384.         Dwarf_Error *error)\fP
  385. .DE
  386. The function \f(CWdwarf_add_AT_location_expr()\fP adds the attribute
  387. specified by \f(CWattr\fP to the \f(CWDIE\fP descriptor given by
  388. \f(CWownerdie\fP.  The attribute should be one that has a location
  389. expression as its value.  The location expression that is the value
  390. is represented by the \f(CWDwarf_P_Expr\fP descriptor \f(CWloc_expr\fP.
  391. It returns the \f(CWDwarf_P_Attribute\fP descriptor for the attribute
  392. given, on success.  On error it returns \f(CWDW_DLV_BADADDR\fP.
  393.  
  394. .DS
  395. \f(CWDwarf_P_Attribute dwarf_add_AT_name(
  396.         Dwarf_P_Die ownerdie, 
  397.         char *name,
  398.         Dwarf_Error *error)\fP
  399. .DE
  400. The function \f(CWdwarf_add_AT_name()\fP adds the string specified
  401. by \f(CWname\fP as the value of the \f(CWDW_AT_name\fP attribute
  402. for the given \f(CWDIE\fP, \f(CWownerdie\fP.  It returns the 
  403. \f(CWDwarf_P_attribute\fP descriptor for the \f(CWDW_AT_name\fP 
  404. attribute on success.  On error, it returns \f(CWDW_DLV_BADADDR\fP.
  405.  
  406. .DS
  407. \f(CWDwarf_P_Attribute dwarf_add_AT_comp_dir(
  408.         Dwarf_P_Die ownerdie,
  409.         char *current_working_directory,
  410.         Dwarf_Error *error)\fP
  411. .DE
  412. The function \f(CWdwarf_add_AT_comp_dir()\fP adds the string given by
  413. \f(CWcurrent_working_directory\fP as the value of the \f(CWDW_AT_comp_dir\fP
  414. attribute for the \f(CWDIE\fP described by the given \f(CWownerdie\fP.  
  415. It returns the \f(CWDwarf_P_Attribute\fP for this attribute on success.
  416. On error, it returns \f(CWDW_DLV_BADADDR\fP.
  417.  
  418. .DS
  419. \f(CWDwarf_P_Attribute dwarf_add_AT_producer(
  420.         Dwarf_P_Die ownerdie,
  421.         char *producer_string,
  422.         Dwarf_Error *error)\fP
  423. .DE
  424. The function \f(CWdwarf_add_AT_producer()\fP adds the string given by
  425. \f(CWproducer_string\fP as the value of the \f(CWDW_AT_producer\fP
  426. attribute for the \f(CWDIE\fP given by \f(CWownerdie\fP.  It returns
  427. the \f(CWDwarf_P_Attribute\fP descriptor representing this attribute
  428. on success.  On error, it returns \f(CWDW_DLV_BADADDR\fP.
  429.  
  430. .DS
  431. \f(CWDwarf_P_Attribute dwarf_add_AT_const_value_signedint(
  432.         Dwarf_P_Die ownerdie,
  433.         Dwarf_Signed signed_value,
  434.         Dwarf_Error *error)\fP
  435. .DE
  436. The function \f(CWdwarf_add_AT_const_value_signedint()\fP adds the
  437. given \f(CWDwarf_Signed\fP value \f(CWsigned_value\fP as the value
  438. of the \f(CWDW_AT_const_value\fP attribute for the \f(CWDIE\fP
  439. described by the given \f(CWownerdie\fP.  It returns the 
  440. \f(CWDwarf_P_Attribute\fP descriptor for this attribute on success.  
  441. On error, it returns \f(CWDW_DLV_BADADDR\fP.
  442.  
  443. .DS
  444. \f(CWDwarf_P_Attribute dwarf_add_AT_const_value_unsignedint(
  445.         Dwarf_P_Die ownerdie,
  446.         Dwarf_Unsigned unsigned_value,
  447.         Dwarf_Error *error)\fP
  448. .DE
  449. The function \f(CWdwarf_add_AT_const_value_unsignedint()\fP adds the
  450. given \f(CWDwarf_Unsigned\fP value \f(CWunsigned_value\fP as the value
  451. of the \f(CWDW_AT_const_value\fP attribute for the \f(CWDIE\fP described 
  452. by the given \f(CWownerdie\fP.  It returns the \f(CWDwarf_P_Attribute\fP
  453. descriptor for this attribute on success.  On error, it returns
  454. \f(CWDW_DLV_BADADDR\fP.
  455.  
  456. .DS
  457. \f(CWDwarf_P_Attribute dwarf_add_AT_const_value_string(
  458.         Dwarf_P_Die ownerdie,
  459.         char *string_value,
  460.         Dwarf_Error *error)\fP
  461. .DE
  462. The function \f(CWdwarf_add_AT_const_value_string()\fP adds the 
  463. string value given by \f(CWstring_value\fP as the value of the 
  464. \f(CWDW_AT_const_value\fP attribute for the \f(CWDIE\fP described 
  465. by the given \f(CWownerdie\fP.  It returns the \f(CWDwarf_P_Attribute\fP
  466. descriptor for this attribute on success.  On error, it returns
  467. \f(CWDW_DLV_BADADDR\fP.
  468.  
  469. .DS
  470. \f(CWDwarf_P_Attribute dwarf_add_AT_targ_address(
  471.         Dwarf_P_Debug dbg,
  472.         Dwarf_P_Die ownerdie,
  473.         Dwarf_Half attr,
  474.         Dwarf_Unsigned pc_value,
  475.         Dwarf_Signed sym_index,
  476.         Dwarf_Error *error)\fP
  477. .DE
  478. The function \f(CWdwarf_add_AT_targ_address()\fP adds an attribute that
  479. belongs to the "address" class to the die specified by \f(CWownerdie\fP.  
  480. The attribute is specified by \f(CWattr\fP, and the object that the 
  481. \f(CWDIE\fP belongs to is specified by \f(CWdbg\fP.  The relocatable 
  482. address that is the value of the attribute is specified by \f(CWpc_value\fP. 
  483. The symbol to be used for relocation is specified by the \f(CWsym_index\fP,
  484. which is the index of the symbol in the Elf symbol table.
  485.  
  486. It returns the \f(CWDwarf_P_Attribute\fP descriptor for the attribute
  487. on success, and \f(CWDW_DLV_BADADDR\fP on error.
  488.  
  489. .DS
  490. \f(CWDwarf_P_Attribute dwarf_add_AT_unsigned_const(
  491.         Dwarf_P_Debug dbg,
  492.         Dwarf_P_Die ownerdie,
  493.         Dwarf_Half attr,
  494.         Dwarf_Unsigned value,
  495.         Dwarf_Error *error)\fP
  496. .DE
  497. The function \f(CWdwarf_add_AT_unsigned_const()\fP adds an attribute
  498. with a \f(CWDwarf_Unsigned\fP value belonging to the "constant" class, 
  499. to the \f(CWDIE\fP specified by \f(CWownerdie\fP.  The object that
  500. the \f(CWDIE\fP belongs to is specified by \f(CWdbg\fP.  The attribute
  501. is specified by \f(CWattr\fP, and its value is specified by \f(CWvalue\fP.
  502.  
  503. It returns the \f(CWDwarf_P_Attribute\fP descriptor for the attribute
  504. on success, and \f(CWDW_DLV_BADADDR\fP on error.
  505.  
  506. .DS
  507. \f(CWDwarf_P_Attribute dwarf_add_AT_signed_const(
  508.         Dwarf_P_Debug dbg,
  509.         Dwarf_P_Die ownerdie,
  510.         Dwarf_Half attr,
  511.         Dwarf_Signed value,
  512.         Dwarf_Error *error)\fP
  513. .DE
  514. The function \f(CWdwarf_add_AT_signed_const()\fP adds an attribute
  515. with a \f(CWDwarf_Signed\fP value belonging to the "constant" class,
  516. to the \f(CWDIE\fP specified by \f(CWownerdie\fP.  The object that
  517. the \f(CWDIE\fP belongs to is specified by \f(CWdbg\fP.  The attribute
  518. is specified by \f(CWattr\fP, and its value is specified by \f(CWvalue\fP.
  519.  
  520. It returns the \f(CWDwarf_P_Attribute\fP descriptor for the attribute
  521. on success, and \f(CWDW_DLV_BADADDR\fP on error.
  522.  
  523. .DS
  524. \f(CWDwarf_P_Attribute dwarf_add_AT_reference(
  525.         Dwarf_P_Debug dbg,
  526.         Dwarf_P_Die ownerdie,
  527.         Dwarf_Half attr,
  528.         Dwarf_P_Die otherdie,
  529.         Dwarf_Error *error)\fP
  530. .DE
  531. The function \f(CWdwarf_add_AT_reference()\fP adds an attribute
  532. with a value that is a reference to another \f(CWDIE\fP in the
  533. compilation-unit to the \f(CWDIE\fP specified by \f(CWownerdie\fP.  
  534. The object that the \f(CWDIE\fP belongs to is specified by \f(CWdbg\fP.  
  535. The attribute is specified by \f(CWattr\fP, and the other \f(CWDIE\fP
  536. being referred to is specified by \f(CWotherdie\fP.
  537.  
  538. It returns the \f(CWDwarf_P_Attribute\fP descriptor for the attribute
  539. on success, and \f(CWDW_DLV_BADADDR\fP on error.
  540.  
  541. .DS
  542. \f(CWDwarf_P_Attribute dwarf_add_AT_flag(
  543.         Dwarf_P_Debug dbg,
  544.         Dwarf_P_Die ownerdie,
  545.         Dwarf_Half attr,
  546.         Dwarf_Small flag,
  547.         Dwarf_Error *error)\fP
  548. .DE
  549. The function \f(CWdwarf_add_AT_flag()\fP adds an attribute with 
  550. a \f(CWDwarf_Small\fP value belonging to the "flag" class, to the 
  551. \f(CWDIE\fP specified by \f(CWownerdie\fP.  The object that the 
  552. \f(CWDIE\fP belongs to is specified by \f(CWdbg\fP.  The attribute
  553. is specified by \f(CWattr\fP, and its value is specified by \f(CWflag\fP.
  554.  
  555. It returns the \f(CWDwarf_P_Attribute\fP descriptor for the attribute
  556. on success, and \f(CWDW_DLV_BADADDR\fP on error.
  557.  
  558. .DS
  559. \f(CWDwarf_P_Attribute dwarf_add_AT_string(
  560.         Dwarf_P_Debug dbg,
  561.         Dwarf_P_Die ownerdie,
  562.         Dwarf_Half attr,
  563.         char *string,
  564.         Dwarf_Error *error)\fP
  565. .DE
  566. The function \f(CWdwarf_add_AT_string()\fP adds an attribute with a 
  567. value that is a character string to the \f(CWDIE\fP specified by 
  568. \f(CWownerdie\fP.  The object that the \f(CWDIE\fP belongs to is 
  569. specified by \f(CWdbg\fP.  The attribute is specified by \f(CWattr\fP, 
  570. and its value is pointed to by \f(CWstring\fP.
  571.  
  572. It returns the \f(CWDwarf_P_Attribute\fP descriptor for the attribute
  573. on success, and \f(CWDW_DLV_BADADDR\fP on error.
  574.  
  575. .H 2 "Expression Creation"
  576. The following functions are used to convert location expressions into
  577. blocks so that attributes with values that are location expressions
  578. can store their values as a \f(CWDW_FORM_blockn\fP value.  This is for 
  579. both .debug_info and .debug_loc expression blocks.
  580.  
  581. To create an expression, first call \f(CWdwarf_new_expr()\fP to get 
  582. a \f(CWDwarf_P_Expr\fP descriptor that can be used to build up the
  583. block containing the location expression.  Then insert the parts of 
  584. the expression in prefix order (exactly the order they would be 
  585. interpreted in in an expression interpreter).  The bytes of the 
  586. expression are then built-up as specified by the user.
  587.  
  588. .DS
  589. \f(CWDwarf_Expr dwarf_new_expr(
  590.         Dwarf_P_Debug dbg,
  591.         Dwarf_Error *error)\fP
  592. .DE
  593. The function \f(CWdwarf_new_expr()\fP creates a new expression area 
  594. in which a location expression stream can be created.  It returns
  595. a \f(CWDwarf_P_Expr\fP descriptor that can be used to add operators
  596. to build up a location expression.  It returns \f(CWNULL\fP on error.
  597.  
  598. .DS
  599. \f(CWDwarf_Unsigned dwarf_add_expr_gen(
  600.         Dwarf_P_Expr expr,
  601.         Dwarf_Small opcode, 
  602.         Dwarf_Unsigned val1,
  603.         Dwarf_Unsigned val2,
  604.         Dwarf_Error *error)\fP
  605. .DE
  606. The function \f(CWdwarf_add_expr_gen()\fP takes an operator specified
  607. by \f(CWopcode\fP, along with up to 2 operands specified by \f(CWval1\fP,
  608. and \f(CWval2\fP, converts it into the \f(CWDwarf\fP representation and 
  609. appends the bytes to the byte stream being assembled for the location
  610. expression represented by \f(CWexpr\fP.  The first operand, if present,
  611. to \f(CWopcode\fP is in \f(CWval1\fP, and the second operand, if present,
  612. is in \f(CWval2\fP.  Both the operands may actually be signed or unsigned
  613. depending on \f(CWopcode\fP.  It returns the number of bytes in the byte
  614. stream for \f(CWexpr\fP currently generated, i.e. after the addition of
  615. \f(CWopcode\fP.  It returns \f(CWDW_DLV_NOCOUNT\fP on error.
  616.  
  617. The function \f(CWdwarf_add_expr_gen()\fP works for all opcodes except
  618. those that have a target address as an operand.  This is because it does
  619. not set up a relocation record that is needed when target addresses are
  620. involved.
  621.  
  622. .DS
  623. \f(CWDwarf_Unsigned dwarf_add_expr_addr(
  624.         Dwarf_P_Expr expr,
  625.         Dwarf_Unsigned address,
  626.         Dwarf_Signed sym_index,
  627.         Dwarf_Error *error)\fP 
  628. .DE
  629. The function \f(CWdwarf_add_expr_addr()\fP is used to add the
  630. \f(CWDW_OP_addr\fP opcode to the location expression represented
  631. by the given \f(CWDwarf_P_Expr\fP descriptor, \f(CWexpr\fP.  The
  632. value of the relocatable address is given by \f(CWaddress\fP.  
  633. The symbol to be used for relocation is given by \f(CWsym_index\fP,
  634. which is the index of the symbol in the Elf symbol table.  It returns 
  635. the number of bytes in the byte stream for \f(CWexpr\fP currently 
  636. generated, i.e. after the addition of the \f(CWDW_OP_addr\fP operator.  
  637. It returns \f(CWDW_DLV_NOCOUNT\fP on error.
  638.  
  639. .DS
  640. \f(CWDwarf_Unsigned dwarf_expr_current_offset(
  641.         Dwarf_P_Expr expr, 
  642.         Dwarf_Error *error)\fP
  643. .DE
  644. The function \f(CWdwarf_expr_current_offset()\fP returns the number
  645. of bytes currently in the byte stream for the location expression
  646. represented by the given \fCW(Dwarf_P_Expr\fP descriptor, \f(CWexpr\fP.
  647. It returns \f(CWDW_DLV_NOCOUNT\fP on error.
  648.  
  649. .DS
  650. \f(CWDwarf_Addr dwarf_expr_into_block(
  651.         Dwarf_P_Expr expr,
  652.         Dwarf_Unsigned *length,
  653.         Dwarf_Error *error)\fP 
  654. .DE
  655. The function \f(CWdwarf_expr_into_block()\fP returns the address
  656. of the start of the byte stream generated for the location expression
  657. represented by the given \f(CWDwarf_P_Expr\fP descriptor, \f(CWexpr\fP.
  658. The length of the byte stream is returned in the location pointed to
  659. by \f(CWlength\fP.  It returns \f(CWDW_DLV_BADADDR\fP on error.
  660.  
  661. .H 2 "Line Number Operations"
  662. These are operations on the .debug_line section.  They provide 
  663. information about instructions in the program and the source 
  664. lines the instruction come from.  Typically, code is generated 
  665. in contiguous blocks, which may then be relocated as contiguous 
  666. blocks.  To make the provision of relocation information more 
  667. efficient, the information is recorded in such a manner that only
  668. the address of the start of the block needs to be relocated.  
  669. This is done by providing the address of the first instruction 
  670. in a block using the function \f(CWdwarf_lne_set_address()\fP.  
  671. Information about the instructions in the block are then added 
  672. using the function \f(CWdwarf_add_line_entry()\fP, which specifies
  673. offsets from the address of the first instruction.  The end of 
  674. a contiguous block is indicated by calling the function 
  675. \f(CWdwarf_lne_end_sequence()\fP.
  676.  
  677. .DS
  678. \f(CWDwarf_Unsigned dwarf_add_line_entry(
  679.         Dwarf_P_Debug dbg,
  680.         Dwarf_Unsigned file_index, 
  681.         Dwarf_Addr code_offset,
  682.         Dwarf_Unsigned lineno, 
  683.         Dwarf_Signed column_number,
  684.         Dwarf_Bool is_source_stmt_begin, 
  685.         Dwarf_Bool is_basic_block_begin,
  686.         Dwarf_Error *error)\fP
  687. .DE
  688. The function \f(CWdwarf_add_line_entry()\fP adds an entry to the
  689. section containing information about source lines.  It specifies
  690. in \f(CWcode_offset\fP, the offset from the address set using
  691. \f(CWdwarfdwarf_lne_set_address()\fP, of the address of the first
  692. instruction in a contiguous block.  The source file that gave rise
  693. to the instruction is specified by \f(CWfile_index\fP, the source
  694. line number is specified by \f(CWlineno\fP, and the source column 
  695. number is specified by \f(CWcolumn_number\fP.  \f(CWfile_index\fP 
  696. is the index of the source file in a list of source files which is 
  697. built up using the function \f(CWdwarf_add_file_decl()\fP. 
  698.  
  699. \f(CWis_source_stmt_begin\fP is a boolean flag that is true only if 
  700. the instruction at \f(CWcode_address\fP is the first instruction in 
  701. the sequence generated for the source line at \f(CWlineno\fP.  Similarly,
  702. \f(CWis_basic_block_begin\fP is a boolean flag that is true only if
  703. the instruction at \f(CWcode_address\fP is the first instruction of
  704. a basic block.
  705.  
  706. It returns \f(CW0\fP on success, and \f(CWDW_DLV_NOCOUNT\fP on error.
  707.  
  708. .DS
  709. \f(CWDwarf_Unsigned dwarf_lne_set_address(
  710.         Dwarf_P_Debug dbg,
  711.         Dwarf_Addr offs,
  712.         Dwarf_Unsigned symidx,
  713.         Dwarf_Error *error)\fP
  714. .DE
  715. The function \f(CWdwarf_lne_set_address()\fP sets the target address
  716. at which a contiguous block of instructions begin.  Information about
  717. the instructions in the block is added to .debug_line using calls to
  718. \f(CWdwarfdwarf_add_line_entry()\fP which specifies the offset of each
  719. instruction in the block relative to the start of the block.  This is 
  720. done so that a single relocation record can be used to obtain the final
  721. target address of every instruction in the block.
  722.  
  723. The relocatable address of the start of the block of instructions is
  724. specified by \f(CWoffs\fP.  The symbol used to relocate the address 
  725. is given by \f(CWsymidx\fP, which is the index of the symbol in the
  726. Elf symbol table.  
  727.  
  728. It returns \f(CW0\fP on success, and \f(CWDW_DLV_NOCOUNT\fP on error.
  729.  
  730. .DS
  731. \f(CWDwarf_Unsigned dwarf_lne_end_sequence(
  732.         Dwarf_P_Debug dbg,
  733.         Dwarf_Error *error)\fP
  734. .DE
  735. The function \f(CWdwarf_lne_end_sequence()\fP indicates the end of a
  736. contiguous block of instructions.  To add information about another
  737. block of instructions, a call to \f(CWdwarf_lne_set_address()\fP will 
  738. have to be made to set the address of the start of the target address
  739. of the block, followed by calls to \f(CWdwarf_add_line_entry()\fP for
  740. each of the instructions in the block.
  741.  
  742. It returns \f(CW0\fP on success, and \f(CWDW_DLV_NOCOUNT\fP on error.
  743.  
  744. .DS
  745. \f(CWDwarf_Unsigned dwarf_add_directory_decl(
  746.         Dwarf_P_Debug dbg,
  747.         char *name,
  748.         Dwarf_Error *error)\fP
  749. .DE
  750. The function \f(CWdwarf_add_directory_decl()\fP adds the string 
  751. specified by \f(CWname\fP to the list of include directories in 
  752. the statement program prologue of the .debug_line section.  The
  753. string should therefore name a directory from which source files
  754. have been used to create the present object.
  755.  
  756. It returns the index of the string just added, in the list of include 
  757. directories for the object.  This index is then used to refer to this 
  758. string.  It returns \f(CWDW_DLV_NOCOUNT\fP on error.
  759.  
  760. .DS
  761. \f(CWDwarf_Unsigned dwarf_add_file_decl(
  762.         Dwarf_P_Debug dbg,
  763.         char *name,
  764.         Dwarf_Unsigned dir_idx,
  765.         Dwarf_Unsigned time_mod,
  766.         Dwarf_Unsigned length,
  767.         Dwarf_Error *error)\fP
  768. .DE
  769. The function \f(CWdwarf_add_file_decl()\fP adds the name of a source
  770. file that contributed to the present object.  The name of the file is
  771. specified by \f(CWname\fP.  In case the name is not a fully-qualified
  772. pathname, it is prefixed with the name of the directory specified by
  773. \f(CWdir_idx\fP.  \f(CWdir_idx\fP is the index of the directory to be
  774. prefixed in the list builtup using \f(CWdwarf_add_directory_decl()\fP.
  775.  
  776. \f(CWtime_mod\fP gives the time at which the file was last modified,
  777. and \f(CWlength\fP gives the length of the file in bytes.
  778.  
  779. It returns the index of the source file in the list built up so far
  780. using this function, on success.  This index can then be used to 
  781. refer to this source file in calls to \f(CWdwarf_add_line_entry()\fP.
  782. On error, it returns \f(CWDW_DLV_NOCOUNT\fP.
  783.  
  784. .H 2 "Fast Access (aranges) Operations"
  785. These functions operate on the .debug_aranges section.  
  786.  
  787. .DS
  788. \f(CWDwarf_Unsigned dwarf_add_arange(
  789.         Dwarf_P_Debug dbg,
  790.         Dwarf_Addr begin_address,
  791.         Dwarf_Unsigned length,
  792.         Dwarf_Signed symbol_index,
  793.         Dwarf_Error *error)\fP
  794. .DE
  795. The function \f(CWdwarf_add_arange()\fP adds another address range 
  796. to be added to the section containing address range information, 
  797.   .debug_aranges.  The relocatable start address of the range is 
  798. specified by \f(CWbegin_address\fP, and the length of the address 
  799. range is specified by \f(CWlength\fP.  The relocatable symbol to be 
  800. used to relocate the start of the address range is specified by 
  801. \f(CWsymbol_index\fP, which is the index of the symbol in the Elf
  802. symbol table.
  803.  
  804. It returns a non-zero value on success, and \f(CW0\fP on error.
  805.  
  806. .H 2 "Fast Access (pubnames) Operations"
  807. These functions operate on the .debug_pubnames section.
  808.  
  809. .DS
  810. \f(CWDwarf_Unsigned dwarf_add_pubname(
  811.         Dwarf_P_Debug dbg,
  812.         Dwarf_P_Die die,
  813.         char *pubname_name,
  814.         Dwarf_Error *error)\fP
  815. .DE
  816. The function \f(CWdwarf_add_pubname()\fP adds the pubname specified
  817. by \f(CWpubname_name\fP to the section containing pubnames, i.e.
  818.   .debug_pubnames.  The \f(CWDIE\fP that represents the function
  819. being named is specified by \f(CWdie\fP.  
  820.  
  821. It returns a non-zero value on success, and \f(CW0\fP on error.
  822.  
  823. .H 2 "Fast Access (weak names) Operations"
  824. These functions operate on the .debug_weaknames section.
  825.  
  826. .DS
  827. \f(CWDwarf_Unsigned dwarf_add_weakname(
  828.         Dwarf_P_Debug dbg,
  829.         Dwarf_P_Die die,
  830.         char *weak_name,
  831.         Dwarf_Error *error)\fP
  832. .DE
  833. The function \f(CWdwarf_add_weakname()\fP adds the weak name specified
  834. by \f(CWweak_name\fP to the section containing weak names, i.e.  
  835.  .debug_weaknames.  The \f(CWDIE\fP that represents the function
  836. being named is specified by \f(CWdie\fP.  
  837.  
  838. It returns a non-zero value on success, and \f(CW0\fP on error.
  839.  
  840. .H 2 "Static Function Names Operations"
  841. The .debug_funcnames section contains the names of static function 
  842. names defined in the object, and also the offsets of the \f(CWDIE\fPs
  843. that represent the definitions of the functions in the .debug_info 
  844. section.
  845.  
  846. .DS
  847. \f(CWDwarf_Unsigned dwarf_add_funcname(
  848.         Dwarf_P_Debug dbg,
  849.         Dwarf_P_Die die,
  850.         char *func_name,
  851.         Dwarf_Error *error)\fP
  852. .DE
  853. The function \f(CWdwarf_add_funcname()\fP adds the name of a static
  854. function specified by \f(CWfunc_name\fP to the section containing the
  855. names of static functions defined in the object represented by \f(CWdbg\fP.
  856. The \f(CWDIE\fP that represents the definition of the function is
  857. specified by \f(CWdie\fP.
  858.  
  859. It returns a non-zero value on success, and \f(CW0\fP on error.
  860.  
  861. .H 2 "File-scope User-defined Type Names Operations"
  862. The .debug_typenames section contains the names of file-scope
  863. user-defined types in the given object, and also the offsets 
  864. of the \f(CWDIE\fPs that represent the definitions of the types 
  865. in the .debug_info section.
  866.  
  867. .DS
  868. \f(CWDwarf_Unsigned dwarf_add_typename(
  869.         Dwarf_P_Debug dbg,
  870.         Dwarf_P_Die die,
  871.         char *type_name,
  872.         Dwarf_Error *error)\fP
  873. .DE
  874. The function \f(CWdwarf_add_typename()\fP adds the name of a file-scope
  875. user-defined type specified by \f(CWtype_name\fP to the section that 
  876. contains the names of file-scope user-defined type.  The object that 
  877. this section belongs to is specified by \f(CWdbg\fP.  The \f(CWDIE\fP 
  878. that represents the definition of the type is specified by \f(CWdie\fP.
  879.  
  880. It returns a non-zero value on success, and \f(CW0\fP on error.
  881.  
  882. .H 2 "File-scope Static Variable Names Operations"
  883. The .debug_varnames section contains the names of file-scope static
  884. variables in the given object, and also the offsets of the \f(CWDIE\fPs
  885. that represent the definition of the variables in the .debug_info
  886. section.
  887.  
  888. .DS
  889. \f(CWDwarf_Unsigned dwarf_add_varname(
  890.         Dwarf_P_Debug dbg,
  891.         Dwarf_P_Die die,
  892.         char *var_name,
  893.         Dwarf_Error *error)\fP
  894. .DE
  895. The function \f(CWdwarf_add_varname()\fP adds the name of a file-scope
  896. static variable specified by \f(CWvar_name\fP to the section that 
  897. contains the names of file-scope static variables defined by the 
  898. object represented by \f(CWdbg\fP.  The \f(CWDIE\fP that represents
  899. the definition of the static variable is specified by \f(CWdie\fP.
  900.  
  901. It returns a non-zero value on success, and \f(CW0\fP on error.
  902.  
  903. .\".H 2 "Macro Information Creation"
  904. .\"
  905. .\".DS
  906. .\"\f(CWDwarf_Unsigned dwarf_mac_define(Dwarf_debug dbg,
  907. .\"    Dwarf_Unsigned lineno,
  908. .\"    char *name_value,
  909. .\"        Dwarf_Error *error);\fP
  910. .\".DE
  911. .\"Returns DWARF_NOCOUNT if there is an error.
  912. .\".DS
  913. .\"\f(CWDwarf_Unsigned dwarf_mac_undefine(Dwarf_debug dbg,
  914. .\"    Dwarf_Unsigned lineno,
  915. .\"    char *name,
  916. .\"        Dwarf_Error *error);\fP
  917. .\".DE
  918. .\"Returns DWARF_NOCOUNT if there is an error.
  919. .\".DS
  920. .\"\f(CWDwarf_Unsigned dwarf_mac_start_file(Dwarf_debug dbg,
  921. .\"    Dwarf_Unsigned lineno,
  922. .\"        Dwarf_Unsigned fileno,
  923. .\"        Dwarf_Error *error);\fP
  924. .\".DE
  925. .\"\f(CWfileno\fP is an index in the .debug_line header: 
  926. .\"the index of
  927. .\"the file name.
  928. .\"Returns DWARF_NOCOUNT if there is an error.
  929. .\".DS
  930. .\"\f(CWDwarf_Unsigned dwarf_file_index_from_lines(Dwarf_debug dbg,
  931. .\"    char *name,
  932. .\"        Dwarf_Error *error);\fP
  933. .\"/* helper function to get .debug_line index: adds to line header 
  934. .\"   table if necessary*/
  935. .\"        /* returns DWARF_NOCOUNT if unable to add or find */
  936. .\"        /* also used by linetable builder */
  937. .\".DE
  938. .\"Helper function to get .debug_line index: adds to line header 
  939. .\"table if necessary.
  940. .\"Returns DWARF_NOCOUNT if unable to add or find.
  941. .\"Also used by linetable builder.
  942. .\".DS
  943. .\"\f(CWDwarf_Unsigned dwarf_mac_end_file(Dwarf_debug dbg,
  944. .\"        Dwarf_Error *error);\fP
  945. .\".DE
  946. .\"Returns DWARF_NOCOUNT if there is an error.
  947.  
  948. .H 2 "Low Level (.debug_frame) operations"
  949. These functions operate on the .debug_frame section.  Refer to 
  950. \fIlibdwarf.h\fP for the register names and register assignment 
  951. mapping.  Both of these are necessarily machine dependent.
  952.  
  953. .DS
  954. \f(CWDwarf_P_Fde dwarf_new_fde(
  955.         Dwarf_P_Debug dbg, 
  956.         Dwarf_Error *error)\fP
  957. .DE
  958. The function \f(CWdwarf_new_fde()\fP returns a new \f(CWDwarf_P_Fde\fP
  959. descriptor that should be used to build a complete \f(CWFDE\fP.  
  960. Subsequent calls to routines that build up the \f(CWFDE\fP should use
  961. the same \f(CWDwarf_P_Fde\fP descriptor.
  962.  
  963. It returns a valid \f(CWDwarf_P_Fde\fP descriptor on success, and
  964. \f(CWDW_DLV_BADADDR\fP on error.
  965.  
  966. .DS
  967. \f(CWDwarf_Unsigned dwarf_add_frame_cie(
  968.         Dwarf_P_Debug dbg,
  969.         char *augmenter, 
  970.         Dwarf_Small code_align,
  971.         Dwarf_Small data_align, 
  972.         Dwarf_Small ret_addr_reg, 
  973.         Dwarf_Ptr init_bytes, 
  974.         Dwarf_Unsigned init_bytes_len,
  975.         Dwarf_Error *error);\fP
  976. .DE
  977. The function \f(CWdwarf_add_frame_cie()\fP creates a \f(CWCIE\fP,
  978. and returns an index to it, that should be used to refer to this
  979. \f(CWCIE\fP.  \f(CWCIE\fPs are used by \f(CWFDE\fPs to setup
  980. initial values for frames.  The augmentation string for the \f(CWCIE\fP
  981. is specified by \f(CWaugmenter\fP.  The code alignement factor,
  982. data alignment factor, and the return address register for the
  983. \f(CWCIE\fP are specified by \f(CWcode_align\fP, \f(CWdata_align\fP,
  984. and \f(CWret_addr_reg\fP respectively.  \f(CWinit_bytes\fP points
  985. to the bytes that represent the instructions for the \f(CWCIE\fP
  986. being created, and \f(CWinit_bytes_len\fP specifies the number
  987. of bytes of instructions.
  988.  
  989. It returns an index to the \f(CWCIE\fP just created on success.
  990. On error it returns \f(CWDW_DLV_NOCOUNT\fP.
  991.  
  992. .DS
  993. \f(CWDwarf_Unsigned dwarf_add_frame_fde(
  994.         Dwarf_P_Debug dbg,
  995.         Dwarf_P_Fde fde,
  996.         Dwarf_P_Die die,
  997.         Dwarf_Unsigned cie,
  998.         Dwarf_Addr virt_addr,
  999.         Dwarf_Unsigned  code_len,
  1000.         Dwarf_Unsigned sym_idx
  1001.         Dwarf_Error* error)\fP
  1002. .DE
  1003. The function \f(CWdwarf_add_frame_fde()\fP adds the \f(CWFDE\fP
  1004. specified by \f(CWfde\fP to the list of \f(CWFDE\fPs for the
  1005. object represented by the given \f(CWdbg\fP.  \f(CWdie\fP specifies
  1006. the \f(CWDIE\fP that represents the function whose frame information
  1007. is specified by the given \f(CWfde\fP.  \f(CWcie\fP specifies the
  1008. index of the \f(CWCIE\fP that should be used to setup the initial
  1009. conditions for the given frame.  \f(CWvirt_addr\fP represents the
  1010. relocatable address at which the code for the given function begins,
  1011. and \f(CWsym_idx\fP gives the index of the relocatable symbol to
  1012. be used to relocate this address (\f(CWvirt_addr\fP that is).
  1013. \f(CWcode_len\fP specifies the size in bytes of the machine instructions
  1014. for the given function.
  1015.  
  1016. It returns an index to the given \f(CWfde\fP.
  1017.  
  1018. .DS
  1019. \f(CWDwarf_P_Fde dwarf_fde_cfa_offset(
  1020.         Dwarf_P_Fde fde,
  1021.         Dwarf_Unsigned reg,
  1022.         Dwarf_Signed offset,
  1023.         Dwarf_Error *error)\fP
  1024. .DE
  1025. The function \f(CWdwarf_fde_cfa_offset()\fP appends a \f(CWDW_CFA_offset\fP
  1026. operation to the \f(CWFDE\fP, specified by \f(CWfde\fP,  being constructed.  
  1027. The first operand of the \f(CWDW_CFA_offset\fP operation is specified by 
  1028. \f(CWreg\P.  The register specified should not exceed 6 bits.  The second 
  1029. operand of the \f(CWDW_CFA_offset\fP operation is specified by \f(CWoffset\fP.
  1030.  
  1031. It returns the given \f(CWfde\fP on success, and \f(CWDW_DLV_BADADDR\fP
  1032. on error.
  1033.  
  1034. .DS
  1035. \f(CWDwarf_P_Fde dwarf_add_fde_inst(
  1036.         Dwarf_P_Fde fde,
  1037.         Dwarf_Small op,
  1038.         Dwarf_Unsigned val1,
  1039.         Dwarf_Unsigned val2,
  1040.         Dwarf_Error *error)\fP
  1041. .DE
  1042. The function \f(CWdwarf_add_fde_inst()\fP adds the operation specified
  1043. by \f(CWop\fP to the \f(CWFDE\fP specified by \f(CWfde\fP.  Upto two
  1044. operands can be specified in \f(CWval1\fP, and \f(CWval2\fP.  Based on
  1045. the operand specified \f(CWLibdwarf\fP decides how many operands are
  1046. meaningful for the operand.  It also converts the operands to the 
  1047. appropriate datatypes even they are passed to \f(CWdwarf_add_fde_inst\fP
  1048. as \f(CWDwarf_Unsigned\fP.
  1049.  
  1050. It returns the given \f(CWfde\fP on success, and \f(CWDW_DLV_BADADDR\fP
  1051. on error.
  1052.  
  1053. .S
  1054. .TC
  1055. .CS
  1056.